package com.ityedao.IO字节流.文件字节输入流.一次读取完全部字节;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

public class FileInputStreamTest {
    public static void main(String[] args) throws Exception {
        FileInputStream is = new FileInputStream("src\\ityedao3.txt");

        File f = new File("src\\ityedao3.txt");
        long size = f.length();
        byte[] buffer = new byte[(int) size]; // 使数组大小与文件大小一致

        int len = is.read(buffer);
        String rs = new String(buffer);
        System.out.println(rs);

        System.out.println(len);
        System.out.println(size);

        // 关闭流
        is.close();
    }
}
